﻿<?php
    if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    /**
     * 
     */
    class User extends CI_Controller {
        
        function __construct() {
            parent::__construct();
			$this->load->helper('url');
			$this->load->model('Muser');
			
        }
	//登录页面
	public function index()
	{
            
            $this->view('userlogin_view','',1);
	}
		
	public function login()
	{
		$chk_login = $this->Muser->login();
		if($chk_login)
		{
			$this->session->set_userdata('admin_user',$chk_login);
			redirect('tlianmengs');
		}else{
			redirect('user');	
		}
	}
	
        public function loginout()
        {
            $this->session->sess_destroy();
            redirect('user');
        }

        /**
     	* 显示页面函数
     	*/
     	
	protected function view($page , $data = '', $is_heard = 0)
	{
		$this->load->view('admin/heard_view');
		if($is_heard != '1')
		{
			$this->load->view('admin/menu_view');
		}
		$this->load->view('admin/'.$page);
			
	}
    }
    
